navMenuService.$inject = ['$http'];

function navMenuService($http) {
    var svc = this;
    svc.menus = [
        {
            state: 'home',
            displayName: 'Home'
        }
    ];

    function addMenu(menu) {
        svc.menus.push(menu);
    }

    function getMenus() {
        return svc.menus;
    }

    function deleteMenu(menu) {

    }

    function logout(callBack) {
        $http.get('/O2OMerchant/api/merchant/logout')
            .then(function successCallBack(response) {
                callBack(response);
            }, function errorCallBack(response) {
                callBack(response);
            })
    }

    return {
        getMenus: getMenus,
        addMenu: addMenu,
        deleteMenu: deleteMenu,
        logout: logout
    }
}

module.exports = navMenuService;